set +e
echo "prepare"

echo "kill instance"
pid=`ps -ef|grep spring| grep -v grep | grep -v tail | grep -v sh | awk '{print $2}'`
if [ -n "$pid" ]
    then
    echo "process id is: $pid"
    echo "here"
    kill -9 $pid || true
    echo 'process killed'
else
    echo "spring-api process id is not found!"
fi

sleep 2s

mv spring2 spring
chmod +x spring

echo "nohup spring"
nohup ./spring >/dev/null 2>&1 &
echo "success running"